home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / pgm_tool / lu62 / comm / curhscb.c < prev    next >
C/C++ Source or Header  |  1995-07-03  |  4KB  |  100 lines

  1. #include "include.h"
  2. #include <string.h>
  3. #include <malloc.h>
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6.  
  7.  extern void *hscb_lst_ptr;
  8.  extern void *nau_lst_ptr;
  9.  
  10.  unsigned long findnau (void *np, void **naupp);
  11.  
  12. /*********************CRHSCB********************************************/
  13.    struct hscb *crhscb( mylu, partlu )
  14.       char *mylu,*partlu;
  15.         {
  16.             unsigned long rc;
  17.             struct hscb *whscb,*whscbq;
  18.             struct nau *wnau;
  19.  
  20.  
  21.                whscb = calloc (1,sizeof(struct hscb));
  22.                if (whscb == NULL )
  23.                     return (NULL);
  24.                rc = findnau ( mylu ,&wnau);
  25.                if (rc != 0)
  26.                     return (NULL);
  27.            whscb->naup = wnau;
  28.                memcpy (whscb->hslunam, partlu, 8);
  29.                wnau -> link = whscb;
  30.                if (hscb_lst_ptr == NULL )
  31.                     hscb_lst_ptr = whscb;
  32.                else
  33.                     {
  34.                         whscbq = hscb_lst_ptr;
  35.                         while (whscbq -> next != NULL )
  36.                                 whscbq = whscbq -> next;
  37.                         whscbq -> next = whscb;
  38.                     }
  39.               return (whscb);
  40.          }
  41.   /*************************FINDHSCB********************************/
  42.  
  43.         struct hscb *findhscb( ccor )
  44.                 char *ccor;
  45.                  {
  46.                     struct hscb *whscb;
  47.                         whscb = hscb_lst_ptr;
  48.                         if (whscb -> cor == ccor)
  49.                                 return(whscb);
  50.                         whscb = whscb -> next;
  51.                         do {
  52.                              if (whscb ->cor == ccor)
  53.                                     return (whscb);
  54.                              whscb = whscb -> next;
  55.                            } while (whscb != NULL );
  56.                        return (NULL);
  57.               }
  58.  /**************************DELHSCB************************************/
  59.  
  60.         int delhscb (whscb)
  61.                 struct hscb *whscb;
  62.                  {
  63.                     struct hscb *whscbq;
  64.                         whscbq = hscb_lst_ptr;
  65.                         if (whscbq == whscb)
  66.                                hscb_lst_ptr = NULL;
  67.                         do {
  68.                               if ( whscbq -> next == whscb)
  69.                                     {
  70.                                         whscbq -> next == whscb -> next;
  71.                                         return;
  72.                                      }
  73.                               whscbq = whscbq -> next;
  74.                           } while ( whscbq != NULL );
  75.                        return;
  76.                  }
  77.  /****************************FINDNAU***********************************/
  78.  
  79.        unsigned long findnau (np,naupp)
  80.             char *np;
  81.             struct nau **naupp;
  82.                {
  83.                  struct nau *naup;
  84.                  int i;
  85.  
  86.                      naup = nau_lst_ptr;
  87.                      i = 0;
  88.                      do {
  89.                           if (memcmp( np, naup -> name,8) == 0)
  90.                                 {
  91.                                     *naupp = naup;
  92.                                     return ( NULL );
  93.                                 }
  94.                           naup ++;
  95.                           i++;
  96.                        } while ( i < 10 );
  97.                     return (i);
  98. }
  99.   /******************************THE END *******************************/
  100.